<?php
use EApiSwoole\Foundation\Application;
if (!function_exists('dd')) {
    function dd($message, $description = null)
    {
         echo "======>>> ".$description." start\n";
                if (\is_array($message)) {
                    echo \var_export($message, true)."\n";
                } else if (\is_string($message)) {
                    echo $message."\n";
                } else {
                    var_dump($message);
                }
                echo  "======>>> ".$description." end\n";
    }
}
if (!function_exists('echoSuccess')) {
    function echoSuccess($message)
    {
		 echo PHP_EOL;
		 echo  "========================================================= ".PHP_EOL;
		 echo '[' . date('Y-m-d H:i:s') . '] [INFO] ' . "\033[32m{$message}\033[0m". PHP_EOL;
		 echo  "========================================================= ".PHP_EOL;
    }
}

if (!function_exists('echoError')) {
    function echoError($message)
    {
		echo PHP_EOL;
		echo  "========================================================= ".PHP_EOL;
         echo '[' . date('Y-m-d H:i:s') . '] [ERROR] ' . "\033[31m{$message}\033[0m". PHP_EOL;
		  echo  "========================================================= ".PHP_EOL;
    }
}

if (!function_exists('app')) {
    function app($a = null)
    {
        if (empty($a)) {
            return Application::getInstance();
        }
        return Application::getInstance()->make($a);
    }
}
if (!function_exists('request')) {
    function request()
    {
        return Application::getInstance()->make('request');
    }
}